package com.ly.maven05.model;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Arrays;
import java.util.Collection;

/**
 * 参数化测试
 * Created by ly on 2018/3/7.
 */
@RunWith(Parameterized.class)
public class WordDealUtilTestWithParam {
    private String expected;
    private String target;

    @Parameterized.Parameters
    public static Collection words() {
        return Arrays.asList(new Object[][]{
                {"employee_info", "employeeInfo"},
                {null, null},
                {"", ""},
                {"employee_info", "EmployeeInfo"},
                {"employee_info", "EMPloyeeInfo"},
                {"employee_info", "employeeInfO"}
        });
    }

    /**
     * 参数化测试必须的构造函数
     * @param expected 期望的测试结果，对应参数集中的第一个参数
     * @param target 测试数据，对应参数集中的第二个参数
     */
    public WordDealUtilTestWithParam(String expected, String target) {
        this.expected = expected;
        this.target = target;
    }

    @Test
    public void wordFormat() {
        Assert.assertEquals(expected, WordDealUtil.wordFormat(target));
    }

}
